<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>bg_mon</title>
<style type="text/css">
* {
	font-size: 14px;
	font-family: "SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace;
}

body {
	margin: 0;
	color: #333;
}

table {
	border-collapse: collapse;
	border-spacing: 0;
	margin-bottom: 20px;
	max-width: 100%;
	width: 100%;
}

table > tbody > tr > td {
	border-top: 1px solid #ddd;
	line-height: 1.42857;
	padding: 8px;
	vertical-align: top;
	text-align: right;
}

table > tbody > tr > td#processes\.locked_by {
	text-align: left;
}

table > thead > tr > th {
	border-bottom: 2px solid #ddd;
	vertical-align: bottom;
	padding: 5px;
	width: 40px;
	text-align: right;
}

table.partitions > thead > tr > th {
	width: 50px;
}

table > tbody > tr:nth-of-type(2n+1) {
	background-color: #f9f9f9;
}

/* http://prismjs.com/download.html?themes=prism&languages=sql */
/**
 * prism.js default theme for JavaScript, CSS and HTML
 * Based on dabblet (http://dabblet.com)
 * @author Lea Verou
 */

code[class*="language-"],
pre[class*="language-"] {
	color: black;
	background: none;
	text-shadow: 0 1px white;
	font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
	text-align: left;
	white-space: pre;
	word-spacing: normal;
	word-break: normal;
	word-wrap: normal;
	line-height: 1.5;

	-moz-tab-size: 4;
	-o-tab-size: 4;
	tab-size: 4;

	-webkit-hyphens: none;
	-moz-hyphens: none;
	-ms-hyphens: none;
	hyphens: none;
}

pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
	text-shadow: none;
	background: #b3d4fc;
}

pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
code[class*="language-"]::selection, code[class*="language-"] ::selection {
	text-shadow: none;
	background: #b3d4fc;
}

@media print {
	code[class*="language-"],
	pre[class*="language-"] {
		text-shadow: none;
	}
}

/* Code blocks */
pre[class*="language-"] {
	padding: 1em;
	margin: .5em 0;
	overflow: auto;
}

:not(pre) > code[class*="language-"],
pre[class*="language-"] {
	background: #f5f2f0;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
	padding: .1em;
	border-radius: .3em;
	white-space: normal;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
	color: slategray;
}

.token.punctuation {
	color: #999;
}

.namespace {
	opacity: .7;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
	color: #905;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
	color: #690;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
	color: #a67f59;
	background: hsla(0, 0%, 100%, .5);
}

.token.atrule,
.token.attr-value,
.token.keyword {
	color: #07a;
}

.token.function {
	color: #DD4A68;
}

.token.regex,
.token.important,
.token.variable {
	color: #e90;
}

.token.important,
.token.bold {
	font-weight: bold;
}
.token.italic {
	font-style: italic;
}

.token.entity {
	cursor: help;
}

</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/smoothie/1.29.0/smoothie.min.js" type="text/javascript"></script>
<script type="text/javascript">
var pause = false;
var timeSeries = {};
var charts = [];
function create_chart(name, min_value, scale, values) {
	var chart_name = name + '.chart';
	var chart = new SmoothieChart({millisPerPixel:1000,maxValueScale:scale,interpolation:'linear',grid:{fillStyle:'#ffffff',millisPerLine:60000,verticalSections:5},labels:{fillStyle:'#000000',disabled:true,fontSize:14,precision:1},timestampFormatter:SmoothieChart.timeFormatter,minValue:min_value});

	timeSeries[chart_name] = {};

	for (var i = 0; i < values.length; ++i) {
		var color = document.getElementById(name + '.' + values[i]).parentNode.style.color;
		var ts = new TimeSeries();
		chart.addTimeSeries(ts, { strokeStyle: color, lineWidth: 1 });
		timeSeries[chart_name][values[i]] = ts;
	}
	chart.streamTo(document.getElementById(chart_name), 0);
	charts.push(chart);
}

function loadJSON(path, success, error) {
	if (pause) return;
	var xhr = new XMLHttpRequest();
	xhr.onreadystatechange = function() {
		if (xhr.readyState === XMLHttpRequest.DONE) {
			if (xhr.status === 200) {
				if (success) {
					data = xhr.responseText;
					if (data.startsWith('[') && !endsWith(data, ']'))
						data += ']';
					success(JSON.parse(data));
				}
			} else {
				if (error)
					error(xhr);
			}
		}
	};
	xhr.open('GET', path, true);
	xhr.send();
}

function process_tmpl(name, data, empty) {
	var tmpl = document.getElementById(name + '_tmpl');
	tmpl.style.display = '';
	var rows = [];
	for (key in data) {
		for (var i = 0; i < empty.length; ++i)
			if (!(empty[i] in data[key]))
				data[key][empty[i]] = '';
		apply(data[key], name + '.');
		rows.push(tmpl.outerHTML);
	}
	tmpl.style.display = 'none';
	return rows.join('');
}

function humanReadableSize(data) {
	var sizes = ['KB', 'MB', 'GB', 'TB'];
	for (a in sizes) {
		if (data / 1024 < 1)
			return data.toFixed(1) + sizes[a];
		data /= 1024;
	}
	return data.toFixed(1) + sizes[sizes.length - 1];
}

function endsWith(str, suffix) {
	return str.indexOf(suffix, str.length - suffix.length) !== -1;
}

function humanReadableTimeInterval(data) {
	var ret = '';
	var days = Math.floor(data / 86400);
	if (days > 0) {
		ret += days + ' day';
		if (days > 1) ret += 's';
		ret += ' ';
	}
	return ret + new Date(data * 1000).toISOString().slice(-13, -5);
}

function sort_processes(data) {
	var blockers = {};
	var children = {};
	var running = [];
	for (var i = 0; i < data.length; ++i) {
		if ('parent_pid' in data[i]) {
			if (data[i]['parent_pid'] in children)
				children[data[i]['parent_pid']].push(data[i]);
			else
				children[data[i]['parent_pid']] = [data[i]];
		} else if ('locked_by' in data[i]) {
			blocked_pid = data[i]['locked_by'][0];
			if (blocked_pid in blockers)
				blockers[blocked_pid].push(data[i]);
			else
				blockers[blocked_pid] = [data[i]];
		} else running.push(data[i]);
	}

	var age_sort = function(a, b) {
		if (!('age' in a || 'age' in b))
			return a['pid'] - b['pid'];
		a = 'age' in a ? a['age'] : Number.MAX_VALUE;
		b = 'age' in b ? b['age'] : Number.MAX_VALUE;
		return b - a;
	};

	var blocked_sort = function(a, b) {
		var ret = a['locked_by'].length - b['locked_by'].length;
		if (ret == 0) ret = age_sort(a, b);
		return ret;
	}

	running.sort(age_sort);

	if (Object.getOwnPropertyNames(blockers).length == 0 && Object.getOwnPropertyNames(children).length == 0)
		return running;

	var ret = [];

	for (var key in children)
		children[key].sort(age_sort);

	for (var r in running) {
		ret.push(r = running[r]);
		if (r['pid'] in children) {
			while (children[r['pid']].length > 0) {
				var child_row = children[r['pid']].shift();
				if (!('query' in child_row))
					child_row['query'] = r['query'];
				child_row['query'] = child_row['parent_pid'] + ': ' + child_row['query'];
				ret.push(child_row);
			}
		} else if (r['pid'] in blockers) {
			var blocked_temp = [];
			var blocked_ret = [];
			Array.prototype.push.apply(blocked_temp, blockers[r['pid']]);
			delete blockers[r['pid']];
			while (blocked_temp.length > 0) {
				var child_row = blocked_temp.shift();
				blocked_ret.push(child_row);
				if (child_row['pid'] in blockers) {
					Array.prototype.push.apply(blocked_temp, blockers[child_row['pid']]);
					delete blockers[child_row['pid']];
				}
			}
			blocked_ret.sort(blocked_sort);
			Array.prototype.push.apply(ret, blocked_ret);
		}
	}
	return ret;
}

function getValue(data, ns) {
	if (ns == 'disk_stats')
		return process_tmpl('disk_stats', data, []);
	else if (ns == 'processes')
		return process_tmpl('processes', sort_processes(data), ['age', 'database', 'username', 'query', 'locked_by']);
	else if (data != '' && (ns == 'system_stats.uptime' || ns == 'processes.age'))
		return humanReadableTimeInterval(data);
	else if (ns == 'postgresql.start_time')
		return new Date(data * 1000).toISOString();
	else if (ns == 'processes.query') {
		return Prism.highlight(data, Prism.languages.sql)
	} else if (ns.indexOf('processes.cpu.') === 0 || ns.indexOf('system_stats.cpu.') === 0)
		return data.toFixed(1)
	else if (ns.indexOf('system_stats.load_average.') === 0)
		return data.toFixed(2)
	else if (ns.indexOf('io.') === 0 && (endsWith(ns, '_read') || endsWith(ns, '_write'))
			|| endsWith(ns, '.io.read') || endsWith(ns, '.io.write'))
		return humanReadableSize(data) + '/s';
	else if (ns.indexOf('.memory.') > -1 || ns.indexOf('.space.') > -1
			|| ns == 'disk_stats.directory.size' || ns == 'processes.uss')
		return humanReadableSize(data);
	else
		return data;
}

function set_diskstats_values(data, type) {
	var attrs = ['read', 'write', 'await', 'reads_ps', 'writes_ps', 'util'];
	var t = data['disk_stats'][type]['device'];
	data['io'][type + '_dev'] = t['name'];
	for (var i = 0; i < attrs.length; ++i)
		data['io'][type + '_' + attrs[i]] = t['io'][attrs[i]];
}

function apply(data, ns, t, only_charts) {
	if (ns == '') {
		t = data['time'];
		data['io'] = {};
		set_diskstats_values(data, 'data')
		if (data['io']['data_dev'] == data['disk_stats']['wal']['device']['name']) {
			var el = document.getElementById('io.wal_tmpl');
			if (el != null) el.style.display = 'none';
		} else
			set_diskstats_values(data, 'wal');

		var el = document.getElementById('cgroup_enabled');
		if (el != null) el.style.display = 'cgroup' in data ? '' : 'none';
	}

	for (var key in data) {
		var ns_key = ns + key;
		var el = document.getElementById(ns_key);
		if (el != null) {
			if (!only_charts) {
				el.innerHTML = getValue(data[key], ns_key);
				if (ns_key == 'processes.query' && 'idle_in_transaction' in data)
					el.innerHTML = 'idle in transaction ' + humanReadableTimeInterval(data['idle_in_transaction']) + ' (' + el.innerHTML + ')';
			}
		} else if (typeof(data[key]) == 'object') {
			var cn = ns_key + '.chart';
			if (cn in timeSeries) {
				if (ns_key == 'system_stats.cpu')
					data[key]['total'] = 100 - data[key]['idle'];
				else if (ns_key == 'system_stats.memory') {
					data[key]['cache'] = data[key]['buffers'] + data[key]['cached'];
					data[key]['used'] = data[key]['total'] - data[key]['free'];
					if (data[key]['used'] > data[key]['cache'])
						data[key]['used'] -= data[key]['cache'];

					var overcommit_display = 'overcommit' in data[key] ? 'inline' : 'none';
					var els = ['tmpl', 'enabled'];
					for (var n = 0; n < els.length; ++n) {
						var el = document.getElementById(ns_key + '.overcommit_' + els[n]);
						if (el != null) el.style.display = overcommit_display;
					}
				}
				for (var n in timeSeries[cn])
					timeSeries[cn][n].append(t, data[key][n]);
			}
			apply(data[key], ns_key + '.', t, only_charts);
		}
	}
}

function on_resize() {
	var w = (window.innerWidth - 40)/2;
	if (w < 600) w = 600;
	for (var n in timeSeries)
		document.getElementById(n).width = w;
}

function body_loaded() {
	create_chart('system_stats.cpu', -10, 1.2, ['total', 'user', 'system', 'iowait']);
	create_chart('system_stats.load_average', -1, 2, ['0', '1', '2']);
	create_chart('system_stats.memory', -1, 1.2, ['used', 'free', 'cache']);
	create_chart('io', -100, 1.2, ['data_read', 'data_write', 'wal_read', 'wal_write']);
	on_resize();

	document.addEventListener("keypress", function(event) {
		if (pause)
			for (var i = 0; i < charts.length; ++i)
				charts[i].start();
		else
			for (var i = 0; i < charts.length; ++i)
				charts[i].stop();
		pause = !pause;
	});

	for (var i = 0; i < 20; ++i) {
		if (i < 10) i = "0" + i;
		loadJSON('/' + i, function(data) {
			for (var key in data) {
				apply(data[key], '', 0, true);
			}
		});
	}

	setInterval(function() {
		loadJSON('/', function(data) {apply(data, '', 0, false)}, alert);
	}, 1000);
}

/* http://prismjs.com/download.html?themes=prism&languages=sql */
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={manual:_self.Prism&&_self.Prism.manual,util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function(e){var t=n.util.type(e);switch(t){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=n.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return n.util.clone(e)})}return e}},languages:{extend:function(e,t){var a=n.util.clone(n.languages[e]);for(var r in t)a[r]=t[r];return a},insertBefore:function(e,t,a,r){r=r||n.languages;var i=r[e];if(2==arguments.length){a=arguments[1];for(var l in a)a.hasOwnProperty(l)&&(i[l]=a[l]);return i}var o={};for(var s in i)if(i.hasOwnProperty(s)){if(s==t)for(var l in a)a.hasOwnProperty(l)&&(o[l]=a[l]);o[s]=i[s]}return n.languages.DFS(n.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,t,a,r){r=r||{};for(var i in e)e.hasOwnProperty(i)&&(t.call(e,i,e[i],a||i),"Object"!==n.util.type(e[i])||r[n.util.objId(e[i])]?"Array"!==n.util.type(e[i])||r[n.util.objId(e[i])]||(r[n.util.objId(e[i])]=!0,n.languages.DFS(e[i],t,i,r)):(r[n.util.objId(e[i])]=!0,n.languages.DFS(e[i],t,null,r)))}},plugins:{},highlightAll:function(e,t){var a={callback:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};n.hooks.run("before-highlightall",a);for(var r,i=a.elements||document.querySelectorAll(a.selector),l=0;r=i[l++];)n.highlightElement(r,e===!0,a.callback)},highlightElement:function(t,a,r){for(var i,l,o=t;o&&!e.test(o.className);)o=o.parentNode;o&&(i=(o.className.match(e)||[,""])[1].toLowerCase(),l=n.languages[i]),t.className=t.className.replace(e,"").replace(/\s+/g," ")+" language-"+i,o=t.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+i);var s=t.textContent,u={element:t,language:i,grammar:l,code:s};if(n.hooks.run("before-sanity-check",u),!u.code||!u.grammar)return u.code&&(n.hooks.run("before-highlight",u),u.element.textContent=u.code,n.hooks.run("after-highlight",u)),n.hooks.run("complete",u),void 0;if(n.hooks.run("before-highlight",u),a&&_self.Worker){var g=new Worker(n.filename);g.onmessage=function(e){u.highlightedCode=e.data,n.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(u.element),n.hooks.run("after-highlight",u),n.hooks.run("complete",u)},g.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=n.highlight(u.code,u.grammar,u.language),n.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(t),n.hooks.run("after-highlight",u),n.hooks.run("complete",u)},highlight:function(e,t,r){var i=n.tokenize(e,t);return a.stringify(n.util.encode(i),r)},matchGrammar:function(e,t,a,r,i,l,o){var s=n.Token;for(var u in a)if(a.hasOwnProperty(u)&&a[u]){if(u==o)return;var g=a[u];g="Array"===n.util.type(g)?g:[g];for(var c=0;c<g.length;++c){var h=g[c],f=h.inside,d=!!h.lookbehind,m=!!h.greedy,p=0,y=h.alias;if(m&&!h.pattern.global){var v=h.pattern.toString().match(/[imuy]*$/)[0];h.pattern=RegExp(h.pattern.source,v+"g")}h=h.pattern||h;for(var b=r,k=i;b<t.length;k+=t[b].length,++b){var w=t[b];if(t.length>e.length)return;if(!(w instanceof s)){h.lastIndex=0;var _=h.exec(w),P=1;if(!_&&m&&b!=t.length-1){if(h.lastIndex=k,_=h.exec(e),!_)break;for(var A=_.index+(d?_[1].length:0),j=_.index+_[0].length,x=b,O=k,S=t.length;S>x&&(j>O||!t[x].type&&!t[x-1].greedy);++x)O+=t[x].length,A>=O&&(++b,k=O);if(t[b]instanceof s||t[x-1].greedy)continue;P=x-b,w=e.slice(k,O),_.index-=k}if(_){d&&(p=_[1].length);var A=_.index+p,_=_[0].slice(p),j=A+_.length,N=w.slice(0,A),C=w.slice(j),E=[b,P];N&&(++b,k+=N.length,E.push(N));var L=new s(u,f?n.tokenize(_,f):_,y,_,m);if(E.push(L),C&&E.push(C),Array.prototype.splice.apply(t,E),1!=P&&n.matchGrammar(e,t,a,b,k,!0,u),l)break}else if(l)break}}}}},tokenize:function(e,t){var a=[e],r=t.rest;if(r){for(var i in r)t[i]=r[i];delete t.rest}return n.matchGrammar(e,a,t,0,0,!1),a},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(t)}}},a=n.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length,this.greedy=!!r};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var i={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}n.hooks.run("wrap",i);var o=Object.keys(i.attributes).map(function(e){return e+'="'+(i.attributes[e]||"").replace(/"/g,"&quot;")+'"'}).join(" ");return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+(o?" "+o:"")+">"+i.content+"</"+i.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,i=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),i&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,!document.addEventListener||n.manual||r.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},string:{pattern:/(^|[^@\\])("|')(?:\\?[\s\S])*?\2/,greedy:!0,lookbehind:!0},variable:/@[\w.$]+|@("|'|`)(?:\\?[\s\S])+?\1/,"function":/\b(?:COUNT|SUM|AVG|MIN|MAX|FIRST|LAST|UCASE|LCASE|MID|LEN|ROUND|NOW|FORMAT)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR VARYING|CHARACTER (?:SET|VARYING)|CHARSET|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COLUMNS|COMMENT|COMMIT|COMMITTED|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|DATA(?:BASES?)?|DATE(?:TIME)?|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITER(?:S)?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE(?: PRECISION)?|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE KEY|ELSE|ENABLE|ENCLOSED BY|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPE(?:D BY)?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTO|INVOKER|ISOLATION LEVEL|JOIN|KEYS?|KILL|LANGUAGE SQL|LAST|LEFT|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MODIFIES SQL DATA|MODIFY|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL(?: CHAR VARYING| CHARACTER(?: VARYING)?| VARCHAR)?|NATURAL|NCHAR(?: VARCHAR)?|NEXT|NO(?: SQL|CHECK|CYCLE)?|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READ(?:S SQL DATA|TEXT)?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEATABLE|REPLICATION|REQUIRE|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE MODE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|START(?:ING BY)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED BY|TEXT(?:SIZE)?|THEN|TIMESTAMP|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNPIVOT|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?)\b/i,"boolean":/\b(?:TRUE|FALSE|NULL)\b/i,number:/\b-?(?:0x)?\d*\.?[\da-f]+\b/,operator:/[-+*\/=%^~]|&&?|\|?\||!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};
</script>
</head>
<body onLoad="body_loaded()" onResize="on_resize()">
<b id="hostname"></b>, up <b id="system_stats.uptime"></b>, <b id="sysname"></b>, <b id="cpu_cores"></b> cores, running processes: <b id="system_stats.processes.running"></b>, blocked processes: <b id="system_stats.processes.blocked"></b>, ctxt <b id="system_stats.ctxt"></b> 
<table>
	<thead>
		<tr>
			<th><canvas id="system_stats.cpu.chart" width="600" height="120"></canvas></th>
			<th><canvas id="system_stats.load_average.chart" width="600" height="120"></canvas></th>
		</tr>
		<tr>
			<td><b>CPU:</b>
				<span style="color: black">Idle <b id="system_stats.cpu.idle"></b>%</span>
				<span style="color: blue">System <b id="system_stats.cpu.system"></b>%</span>
				<span style="color: green">User <b id="system_stats.cpu.user"></b>%</span>
				<span style="color: orange">Total <b id="system_stats.cpu.total"></b>%</span>
				<span style="color: red">IOWait <b id="system_stats.cpu.iowait"></b>%</span>
			</td>
			<td><b>Load average:</b>
				<span style="color: black">1 min <b id="system_stats.load_average.0"></b></span>
				<span style="color: orange">5 min <b id="system_stats.load_average.1"></b></span>
				<span style="color: red">15 min <b id="system_stats.load_average.2"></b></span>
			</td>
		</tr>
		<tr>
			<th><canvas id="system_stats.memory.chart" width="600" height="120"></canvas></th>
			<th><canvas id="io.chart" width="600" height="120"></canvas></th>
		</tr>
		<tr>
			<td><b>Mem:</b>
				<span style="color: black">Total <b id="system_stats.memory.total"></b></span>
				<span style="color: blue">Used <b id="system_stats.memory.used"></b></span>
				<span style="color: green">Free <b id="system_stats.memory.free"></b></span>
				<span style="color: orange">Buffers+Cache <b id="system_stats.memory.cache"></b></span><br id="system_stats.memory.overcommit_enabled">
				<span style="color: black">Dirty <b id="system_stats.memory.dirty"></b></span>
				<div id="system_stats.memory.overcommit_tmpl"><span style="color: black">Limit <b id="system_stats.memory.overcommit.commit_limit"></b> as <b id="system_stats.memory.overcommit.committed_as"></b></span></div>
			</td>
			<td>
				<span style="color: black">data/<b id="io.data_dev"></b>:</span>
				<span style="color: green">Read: <b id="io.data_read"></b></span>
				<span style="color: orange">Write: <b id="io.data_write"></b></span>
				<span style="color: black">Reads/s: <b id="io.data_reads_ps"></b></span>
				<span style="color: black">Writes/s: <b id="io.data_writes_ps"></b></span>
				<span style="color: black">Await: <b id="io.data_await"></b></span>
				<span style="color: black">%Util: <b id="io.data_util"></b></span>
				<div id="io.wal_tmpl">
					<span style="color: black">wal/<b id="io.wal_dev"></b>:</span>
					<span style="color: blue">Read: <b id="io.wal_read"></b></span>
					<span style="color: red">Write: <b id="io.wal_write"></b></span>
					<span style="color: black">Reads/s: <b id="io.wal_reads_ps"></b></span>
					<span style="color: black">Writes/s: <b id="io.wal_writes_ps"></b></span>
					<span style="color: black">Await: <b id="io.wal_await"></b></span>
					<span style="color: black">%Util: <b id="io.wal_util"></b></span>
				</div>
			</td>
		</tr>
		<tr id="cgroup_enabled">
			<td><b>cgroup Mem:</b>
				<span>RSS: <b id="cgroup.memory.rss"></b></span>
				<span>Cache: <b id="cgroup.memory.cache"></b></span>
				<span>Usage: <b id="cgroup.memory.usage"></b></span>
				<span>Limit: <b id="cgroup.memory.limit"></b></span>
			</td>
			<td><b>cgroup CPU:</b>
				<span>User: <b id="cgroup.cpu.user"></b>%</span>
				<span>System: <b id="cgroup.cpu.system"></b>%</span>
				<span>Shares: <b id="cgroup.cpu.shares"></b></span>
				<span>Quota: <b id="cgroup.cpu.quota"></b></span>
			</td>
		</tr>
	</thead>
</table>
<h2>Partitions</h2>
<table class="partitions">
	<thead>
		<tr>
			<th>Device</th>
			<th style="width: 100px">Read</th>
			<th>Reads/s</th>
			<th style="width: 100px">Write</th>
			<th>Write/s</th>
			<th>Await</th>
			<th>%Util</th>
			<th>Total</th>
			<th>Free</th>
			<th>Size</th>
			<th style="text-align: left; width: auto">Path</th>
		</tr>
	</thead>
	<tbody id="disk_stats"></tbody>
	<tr id="disk_stats_tmpl">
		<td id="disk_stats.device.name"></td>
		<td id="disk_stats.device.io.read"></td>
		<td id="disk_stats.device.io.reads_ps"></td>
		<td id="disk_stats.device.io.write"></td>
		<td id="disk_stats.device.io.writes_ps"></td>
		<td id="disk_stats.device.io.await"></td>
		<td id="disk_stats.device.io.util"></td>
		<td id="disk_stats.device.space.total"></td>
		<td id="disk_stats.device.space.left"></td>
		<td id="disk_stats.directory.size"></td>
		<td id="disk_stats.directory.name" style="text-align: left"></td>
	</tr>
</table>

<h2><b id="postgresql.role"></b>, <b id="postgresql.version"></b>, started <b id="postgresql.start_time"></b>, connections <b id="postgresql.connections.active"></b>/<b id="postgresql.connections.total"></b> of maximum <b id="postgresql.connections.max"></b></h2>
<table>
	<thead>
		<tr>
			<th>Pid</th>
			<th>Lock</th>
			<th style="width: 160px">Type</th>
			<th>State</th><th>utime</th>
			<th>stime</th>
			<th style="width: 100px">Read</th>
			<th style="width: 100px">Write</th>
			<th>uss</th>
			<th>Age</th>
			<th style="text-align: left; width: 110px">Database</th>
			<th style="text-align: left; width: 110px">User</th>
			<th style="text-align: left; width: auto">Query</th>
		</tr>
	</thead>
	<tbody id="processes"></tbody>
	<tr id="processes_tmpl">
		<td id="processes.pid"></td>
		<td id="processes.locked_by"></td>
		<td id="processes.type"></td>
		<td id="processes.state"></td>
		<td id="processes.cpu.user"></td>
		<td id="processes.cpu.system"></td>
		<td id="processes.io.read"></td>
		<td id="processes.io.write"></td>
		<td id="processes.uss"></td>
		<td id="processes.age"></td>
		<td id="processes.database" style="text-align: left"></td>
		<td id="processes.username" style="text-align: left"></td>
		<td id="processes.query" style="text-align: left"></td>
	</tr>
</table>
</body>
</html>
